home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-06-24 | 1.9 KB | 64 lines | [TEXT/MPS ] |
- *
- * MPWCallCompletion.a
- * Copyright © 1992, Apple Computer Inc., All Rights Reserved.
- *
- * This function is called by the driver when the request
- * completes. If the user has defined a completion routine,
- * it restores A5 and calls the user's routine as if it
- * were defined as
- * void
- * UserCompletion(
- * ParmBlockPtr pb
- * );
- * For convenience, the ioResult code is in D0, and the condition
- * codes are set on the ioResult.
- *
- * This file is compiled by MPW and linked with the actual driver C
- * source files. It is not used when the driver is compiled by Think C.
- *
- * Author: Martin Minow
- * Apple Computer Inc.
- * Cupertino, CA, USA
- * InterNet: minow@apple.com
- * AppleLink: MINOW
- *
- print push,off ; Don't waste paper
- include 'SysEqu.a'
- include 'DriverGlue.incl.a' ; MacsBug name macro
- print pop
- case obj
-
- *
- * DirParamHeader is defined in OCEAuthDir.h
- *
- DirParamHeader record 0 ; struct DirParamBlock {
- qLink ds.l 1 ; Ptr qLink;
- reserved_H1 ds.l 1 ; long reserved_H1;
- reserved_H2 ds.l 1 ; long reserved_H2;
- ioCompletion ds.l 1 ; ProcPtr ioCompletion;
- ioResult ds.w 1 ; OSErr ioResult;
- saveA5 ds.l 1 ; long saveA5;
- reqCode ds.w 1 ; short reqCode;
- endr ; };
-
- CallCompletion proc export
- with DirParamHeader
- move.l 4(sp),a0 ; a0 -> parameter block
- move.w ioResult(a0),d0 ; d0 == ioResult
- move.l ioCompletion(a0),d1 ; Get user completion, if any
- beq.s @1 ; Exit if none
- move.l a5,-(sp) ; Save current A5
- move.l saveA5(a0),a5 ; Restore user A5
- link a6,#0 ; Establish a stack frame context
- move.l a0,-(sp) ; Push call parameter
- move.l d1,a1 ; Locate the function
- tst.w d0 ; Set condition codes
- jsr (a1) ; Call user completion
- unlk a6 ; Clean out the stack
- move.l (sp)+,a5 ; Restore current A5
- @1 rts ; Exit from CallCompletion
- endwith
- DbgInfo CallCompletion
- endp
- end
-